package particle.media;

public class AudioInfo {
	public class AudioItemInfo {
		public int bit;
		public int sampleRate;
		public int bitRate;
		public int duration;
	}

	private static AudioInfo instance = new AudioInfo();
	static {
		System.loadLibrary("Id3info");
	}

	private AudioInfo() {

	}

	public static AudioInfo getInstance() {
		return instance;
	}

	// 0: bit 1: sample rate 2: bit rate 3:duration
	public native void getAudioInfo(String path, int info[]);

	public AudioItemInfo getAudioInfo(String path) {
		AudioItemInfo itemInfo = new AudioItemInfo();
		int[] info = new int[4];
		getAudioInfo(path, info);
		itemInfo.bit = info[0];
		itemInfo.sampleRate = info[1];
		itemInfo.bitRate = info[2];
		itemInfo.duration = info[3];
		return itemInfo;
	}
}
